package com.example.zk.viewModel

import androidx.databinding.adapters.AutoCompleteTextViewBindingAdapter.IsValid
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.example.base.entity.CarEntityResult
import com.example.base.mvvm.BaseViewModel
import kotlinx.coroutines.launch

class CarViewModel:BaseViewModel() {
    val carSuccess = MutableLiveData<CarEntityResult>()
    val carFail = MutableLiveData<String>()
    fun car(isValid: String,limit:String,page:String){
        viewModelScope.launch {
            try {
                carSuccess.value = apiService.getCar(isValid, limit, page)
            }catch (e:Exception){
                carFail.value = e.message
            }
        }
    }
}